SPB Git forge

spb/websensor

Public
33commits 1branches 0releases
3.4 MBsize
maindefault branch
10 days agolast push
TypeScript 55.4% Python 43.2% SQL 1.2%
707 B · 16 lines tsx
Raw Blame History
1import { notFound } from "next/navigation";2import type { ReactNode } from "react";3import { api } from "@/lib/api";4import { countryBySlug, COUNTRIES } from "@websensor/core/client";56/**7 * Existence check outside the `loading.tsx` boundary so unknown country slugs return a real 404 instead of a8 * 200 shell followed by the not-found UI (the page's own call is deduplicated by fetch memoization).9 */10export default async function CountryLayout({ params, children }: { params: Promise<{ slug: string }>; children: ReactNode }) {11  const { slug } = await params;12  if (!countryBySlug(slug) && !COUNTRIES[slug.toUpperCase()]) notFound();13  if (!(await api.country(slug))) notFound();14  return children;15}16